package com.phone580.app.register;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.phone580.app.BaseTask;
import com.phone580.app.CommonData;
import com.phone580.app.entity.RegisterEntity;
import com.phone580.app.model.RegisterModel;
import com.phone580.app.net.HttpAccess;

public class RegisterTask extends BaseTask {
	private String username;
	private String pwd;
	private String email;

	public RegisterTask(Context context) {
		super(context);
	}
	
	@Override
	protected void onPreExecute() {
		showDialog("正在提交数据", false);
	}

	@Override
	public void setParams(Object... params) {
		username = (String)params[0];
		pwd = (String) params[1];
		email = (String) params[2];
	}

	@Override
	protected Object doInBackground(Void... params) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("staffCode", username);
		map.put("password", pwd);
		map.put("email", email);
		try {
			String result = HttpAccess.doGet(CommonData.REG_URL, map);
			RegisterModel model = new RegisterModel();
			RegisterEntity entity = model.parseRegister(result.trim());
			return entity;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	

}
